package cs236369.hw5;

import java.util.Date;

/**
 * This class represents a user in the system
 * @author Eddie and Yuval
 *
 */
public class User {
	/**
	 * Constructor...
	 * @param uName user name
	 * @param passwd password
	 * @param firstName first name, can be null
	 * @param lastName last name, can be null
	 * @param isAdmin true if the user is administrator, false otherwise
	 * @param birthDate user's birth date, can be null
	 * @param picPath full path of the users picture, can be null
	 * @param mail user's E-mail, can be null
	 * @throws CrowdsourcingException 
	 */
	public User (String uName, String passwd, String firstName, String lastName, boolean isAdmin, 
			Date birthDate, String picPath, String mail) throws CrowdsourcingException {
		if (uName==null || passwd==null) {
			throw new CrowdsourcingException("nullParam", "a user construction failure because"+
					" a basic parameter is null");
		}
		this.uName = uName;
		this.passwd = passwd;
		this.firstName = firstName;
		this.lastName = lastName;
		this.isAdmin = isAdmin;
		this.birthDate = new Date(birthDate.getTime());
		this.picPath = picPath;
		this.mail = mail;
	}
	
	public String getUserName(){
		return uName;
	}
	
	public String getFirstName(){
		return firstName;
	}
	
	public String getLastName(){
		return lastName;
	}
	
	public String getPassword(){
		return passwd;
	}
	
	public Date getBirthDate(){
		return birthDate;
	}
	
	public String getPicPath(){
		return picPath;
	}
	
	public String getEmailAddress(){
		return mail;
	}
	
	public boolean getIsAdmin(){
		return isAdmin;
	}
	
	private String uName, passwd, firstName, lastName;
	private boolean isAdmin;
	private Date  birthDate;
	private String picPath, mail;
}
